// MESSAGE BEACON_RESPONSE support class

#pragma once

namespace mavlink {
namespace fppa {
namespace msg {

/**
 * @brief BEACON_RESPONSE message
 *
 * Response the params of beacon
 */
struct BEACON_RESPONSE : mavlink::Message {
    static constexpr msgid_t MSG_ID = 171;
    static constexpr size_t LENGTH = 112;
    static constexpr size_t MIN_LENGTH = 112;
    static constexpr uint8_t CRC_EXTRA = 252;
    static constexpr auto NAME = "BEACON_RESPONSE";


    uint32_t status; /*<  status */
    uint32_t res1; /*<  res1 */
    uint8_t cmd; /*<  Response the params of beacon at dvb/beacon/radio mode. */
    uint8_t dvb_feed_volt; /*<  dvb feed volt. */
    uint8_t dvb_22k; /*<  dvb 22k. */
    uint8_t dvb_period; /*<  dvb period. */
    uint8_t dvb_id; /*<  dvb period. */
    float dvb_freq; /*<  dvb frequency(ka.MHz). */
    uint32_t dvb_symb; /*<  dvb symbol rate. */
    uint32_t dvb_rng; /*<  dvb range. */
    uint8_t dvb_mcod; /*<  dvb mode code. */
    uint8_t dvb_roll; /*<  dvb roll. */
    uint8_t dvb_std; /*<  dvb standard code. */
    uint8_t dvb_alg; /*<  dvb algorithm. */
    uint8_t dvb_pr; /*<  dvb punch rate. */
    uint8_t beacon_feed_volt; /*<  beacon feed volt. */
    uint8_t beacon_22k; /*<  beacon 22k. */
    uint8_t beacon_period; /*<  beacon period. */
    float beacon_freq; /*<  beacon frequency(ka.MHz). */
    uint8_t beacon_rng; /*<  beacon range. */
    uint8_t radio_feed_volt; /*<  radio feed volt. */
    uint8_t radio_22k; /*<  radio 22k. */
    uint8_t radio_period; /*<  radio period. */
    float radio_freq; /*<  radio frequency(ka.MHz). */
    uint32_t radio_symb; /*<  radio symbol rate. */
    uint16_t radio_scan_rng; /*<  radio scan range. */
    uint8_t radio_roll; /*<  radio roll. */
    std::array<uint8_t, 60> ascii_info; /*<  ascii information. */


    inline std::string get_name(void) const override
    {
            return NAME;
    }

    inline Info get_message_info(void) const override
    {
            return { MSG_ID, LENGTH, MIN_LENGTH, CRC_EXTRA };
    }

    inline std::string to_yaml(void) const override
    {
        std::stringstream ss;

        ss << NAME << ":" << std::endl;
        ss << "  status: " << status << std::endl;
        ss << "  res1: " << res1 << std::endl;
        ss << "  cmd: " << +cmd << std::endl;
        ss << "  dvb_feed_volt: " << +dvb_feed_volt << std::endl;
        ss << "  dvb_22k: " << +dvb_22k << std::endl;
        ss << "  dvb_period: " << +dvb_period << std::endl;
        ss << "  dvb_id: " << +dvb_id << std::endl;
        ss << "  dvb_freq: " << dvb_freq << std::endl;
        ss << "  dvb_symb: " << dvb_symb << std::endl;
        ss << "  dvb_rng: " << dvb_rng << std::endl;
        ss << "  dvb_mcod: " << +dvb_mcod << std::endl;
        ss << "  dvb_roll: " << +dvb_roll << std::endl;
        ss << "  dvb_std: " << +dvb_std << std::endl;
        ss << "  dvb_alg: " << +dvb_alg << std::endl;
        ss << "  dvb_pr: " << +dvb_pr << std::endl;
        ss << "  beacon_feed_volt: " << +beacon_feed_volt << std::endl;
        ss << "  beacon_22k: " << +beacon_22k << std::endl;
        ss << "  beacon_period: " << +beacon_period << std::endl;
        ss << "  beacon_freq: " << beacon_freq << std::endl;
        ss << "  beacon_rng: " << +beacon_rng << std::endl;
        ss << "  radio_feed_volt: " << +radio_feed_volt << std::endl;
        ss << "  radio_22k: " << +radio_22k << std::endl;
        ss << "  radio_period: " << +radio_period << std::endl;
        ss << "  radio_freq: " << radio_freq << std::endl;
        ss << "  radio_symb: " << radio_symb << std::endl;
        ss << "  radio_scan_rng: " << radio_scan_rng << std::endl;
        ss << "  radio_roll: " << +radio_roll << std::endl;
        ss << "  ascii_info: [" << to_string(ascii_info) << "]" << std::endl;

        return ss.str();
    }

    inline void serialize(mavlink::MsgMap &map) const override
    {
        map.reset(MSG_ID, LENGTH);

        map << status;                        // offset: 0
        map << res1;                          // offset: 4
        map << dvb_freq;                      // offset: 8
        map << dvb_symb;                      // offset: 12
        map << dvb_rng;                       // offset: 16
        map << beacon_freq;                   // offset: 20
        map << radio_freq;                    // offset: 24
        map << radio_symb;                    // offset: 28
        map << radio_scan_rng;                // offset: 32
        map << cmd;                           // offset: 34
        map << dvb_feed_volt;                 // offset: 35
        map << dvb_22k;                       // offset: 36
        map << dvb_period;                    // offset: 37
        map << dvb_id;                        // offset: 38
        map << dvb_mcod;                      // offset: 39
        map << dvb_roll;                      // offset: 40
        map << dvb_std;                       // offset: 41
        map << dvb_alg;                       // offset: 42
        map << dvb_pr;                        // offset: 43
        map << beacon_feed_volt;              // offset: 44
        map << beacon_22k;                    // offset: 45
        map << beacon_period;                 // offset: 46
        map << beacon_rng;                    // offset: 47
        map << radio_feed_volt;               // offset: 48
        map << radio_22k;                     // offset: 49
        map << radio_period;                  // offset: 50
        map << radio_roll;                    // offset: 51
        map << ascii_info;                    // offset: 52
    }

    inline void deserialize(mavlink::MsgMap &map) override
    {
        map >> status;                        // offset: 0
        map >> res1;                          // offset: 4
        map >> dvb_freq;                      // offset: 8
        map >> dvb_symb;                      // offset: 12
        map >> dvb_rng;                       // offset: 16
        map >> beacon_freq;                   // offset: 20
        map >> radio_freq;                    // offset: 24
        map >> radio_symb;                    // offset: 28
        map >> radio_scan_rng;                // offset: 32
        map >> cmd;                           // offset: 34
        map >> dvb_feed_volt;                 // offset: 35
        map >> dvb_22k;                       // offset: 36
        map >> dvb_period;                    // offset: 37
        map >> dvb_id;                        // offset: 38
        map >> dvb_mcod;                      // offset: 39
        map >> dvb_roll;                      // offset: 40
        map >> dvb_std;                       // offset: 41
        map >> dvb_alg;                       // offset: 42
        map >> dvb_pr;                        // offset: 43
        map >> beacon_feed_volt;              // offset: 44
        map >> beacon_22k;                    // offset: 45
        map >> beacon_period;                 // offset: 46
        map >> beacon_rng;                    // offset: 47
        map >> radio_feed_volt;               // offset: 48
        map >> radio_22k;                     // offset: 49
        map >> radio_period;                  // offset: 50
        map >> radio_roll;                    // offset: 51
        map >> ascii_info;                    // offset: 52
    }
};

} // namespace msg
} // namespace fppa
} // namespace mavlink
